#ifndef _COMMU_WS_H_
#define _COMMU_WS_H_

#include "esp_websocket_client.h"
#include "commu_ota.h"
#include "esp_crt_bundle.h"
#include "cJSON.h"
#include "freertos/event_groups.h"
#include "iot.h"

typedef struct
{

    bool is_connected;
    EventGroupHandle_t eg;
    void (*text_cb)(char *, int);
    void (*bin_cb)(char *, int);
    void (*close_cb)(void);

} my_ws_t;
extern my_ws_t my_ws;

void commu_ws_init(void (*text_cb)(char *, int),
                   void (*bin_cb)(char *, int),
                   void (*close_cb)(void));

void commu_ws_send_txt(char *txt);

void commu_ws_send_bin(char *bin, int len);

void commu_ws_send_hello(void);

void commu_ws_send_abort(void);

void commu_ws_send_wake(void);

void commu_ws_start_listening(void);

void commu_ws_stop_listening(void);

void commu_ws__send_iot_descriptor(void);

void commu_ws_send_iot_state(void);

void commu_ws_open_audio_channel(void);

#endif // _COMMU_WS_H_